package com.jeecg.study.action.impl;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jeecg.study.action.ActionNew;
import com.jeecg.study.entity.UserReg;
import com.jeecg.study.form.ActionForm;

public class RegisterAction implements ActionNew {

	@Override
	public String execute(HttpServletRequest request, HttpServletResponse response, ActionForm actionForm,
			Map<String, String> mapping) {
		UserReg userReg=(UserReg)actionForm;
		System.out.println(userReg);
		if("admin".equals(userReg.getUserName())){
			request.setAttribute("message", "用户名存在!");
			return mapping.get("fail");
		}
		request.setAttribute("message", "注册成功!");
		request.setAttribute("userReg", userReg);
		return mapping.get("success");
	}

}
